//
//  SolarSeekEngine.h
//  SolarSeek
//
//  Created by Erick Fejta on 05/03/10.
//  Copyright 2005 Erick Fejta. All rights reserved.
//

#import <Cocoa/Cocoa.h>

#import "EnumTypes.h"
#import "Peers.h"
#import "EngineDefaults.h"

@class ServerConnection;
@class ServerConnectionController;
@class PeerConnectionsController;
@class PeersController;
@class ConnectionsIdentifier;
@class ShareController;
@class SearchesController;
@class TransfersController;
@class ChatsController;
@class Message;
@class Peer;

extern NSString *SolarSeekKeyPathMessageServer;
extern NSString *SolarSeekKeyPathMessagePeer;
extern NSString *SolarSeekKeyPathPeerSentMessage;

@class SolarSeekEngine;

extern int LogTypeNone; 
extern int LogTypeAll;
extern int LogTypeLoud; 
extern int	LogTypeError; 
extern int	LogTypeServer; 
extern int	LogTypePeer;
extern int	LogTypeLoad;
extern int	LogTypeSearch;
extern int	LogTypeTransfer;
extern int  LogTypeShare;

#define LogType int

@interface NSApplication (SolarSeekEngineAccess)
- (SolarSeekEngine *)engine;
- (NSString *)password;
- (void)appendLogWithHeader:(NSString *)header HTML:(NSString *)html type:(LogType)type;
@end


@interface SolarSeekEngine : NSObject {
	ConnectionsIdentifier *_connectionsIdentifier;
	PeerConnectionsController *_peerConnectionsController;
	PeersController *_peersController;
	SearchesController *_searchesController;
	ServerConnection *_serverConnection;
	ServerConnectionController *_serverConnectionController;
	ShareController *_shareController;
	TransfersController *_transfersController;
	ChatsController *_chatsController;
	
	NSMutableArray *_messagesServer;
	Peer *_me;
}

- (ConnectionsIdentifier *)connectionsIdentifier;
- (PeerConnectionsController *)peerConnectionsController;
- (PeersController *)peersController;
- (SearchesController *)searchesController;
- (ServerConnection *)serverConnection;
- (ServerConnectionController *)serverConnectionController;
- (ShareController *)shareController;
- (TransfersController *)transfersController;
- (ChatsController *)chatsController;

//- (Message *)messageServer;
//- (Message *)messagePeer;
//- (Peer *)peerSentMessage;

- (void)updateStatusPeer:(Peer *)peer;
- (void)watchPeer:(Peer *)peer;
- (void)stopWatchingPeer:(Peer *)peer;

- (void)setAvailability:(Availability)availability;
- (void)sendServerMessage:(Message *)message;
//- (void)sendPeer:(Peer *)peer message:(Message *)message;

- (Peer *)me;
- (Peer *)peerNamed:(NSString *)name;

- (void)getBuddyIconForPeer:(Peer *)peer;

- (unsigned)tokenNext;

@end

